/*
Undici Request Types

*/
type UndiciHeadersInit =
    | [string, string][]
    | Record<string, string | readonly string[]>
    | Headers

type UndiciBodyInit = 
    | ArrayBuffer
    | AsyncIterable<Uint8Array>
    | Blob
    | FormData
    | Iterable<Uint8Array>
    | ArrayBufferView
    | URLSearchParams
    | null
    | string

type UndiciRequestRedirect = 'error' | 'follow' | 'manual'

type UndiciRequestCredentials = 'omit' | 'include' | 'same-origin'

type UndiciReferrerPolicy =
    | ''
    | 'no-referrer'
    | 'no-referrer-when-downgrade'
    | 'origin'
    | 'origin-when-cross-origin'
    | 'same-origin'
    | 'strict-origin'
    | 'strict-origin-when-cross-origin'
    | 'unsafe-url'

type UndiciRequestMode = 'cors' | 'navigate' | 'no-cors' | 'same-origin'

type UndiciRequestDuplex = 'half'

type UndiciRequestInit = {
    body?: UndiciBodyInit | null
    credentials?: UndiciRequestCredentials
    dispatcher?: unknown
    duplex?: UndiciRequestDuplex
    headers?: UndiciHeadersInit
    integrity?: string
    keepalive?: boolean
    method?: string
    mode?: UndiciRequestMode
    redirect?: UndiciRequestRedirect
    referrer?: string
    referrerPolicy?: UndiciReferrerPolicy
    signal?: AbortSignal | null
    window?: Window | null
}

type CombinedRequestInit = RequestInit & UndiciRequestInit;

export type CenoRequestInit = {[K in keyof CombinedRequestInit]-?: true}

export type CenoRequest<T = unknown> = {
    json: <J = T>() => Promise<J>;
} & Request